<template>
  <div v-if="Object.keys(goods).length !== 0" id="base-info">
    <div class="title-info">
      {{ goods.title }}
    </div>
    <div class="price-info">
      <span class="n-price">{{ goods.price }}</span
      ><span class="o-price">{{ goods.oldPrice }}</span
      ><span
        class="discount"
        v-if="goods.discountDesc"
        :style="{ backgroundColor: goods.discountBgColor }"
        >{{ goods.discountDesc }}</span
      >
    </div>
    <div class="other-info">
      <span>{{ goods.columns[0] }}</span>
      <span>{{ goods.columns[1] }}</span>
      <span>{{ goods.services[goods.services.length - 1].name }}</span>
    </div>
    <div class="service-info">
      <span
        v-for="index in goods.services.length - 1"
        :key="index"
        class="service-item"
      >
        <img :src="goods.services[index - 1].icon" alt="" />
        <span>{{ goods.services[index - 1].name }}</span>
      </span>
    </div>
  </div>
</template>

<script>
export default {
  name: "baseInfoDetail",
  props: {
    goods: {
      type: Object,
    },
  },
};
</script>

<style scoped>
#base-info {
  margin-top: 15px;
  padding: 0 8px;
  color: #999;
  border-bottom: 5px solid #f2f5f8;
}
.title-info {
  color: #222;
}
.price-info {
  margin-top: 10px;
}
.n-price {
  color: var(--color-high-text);
  font-size: 24px;
}
.o-price {
  margin-left: 5px;
  font-size: 13px;
  text-decoration: line-through;
}
.discount {
  font-size: 12px;
  position: relative;
  top: -8px;
  border-radius: 8px;
  color: #fff;
  padding: 2px 5px;
  margin-left: 5px;
}
.other-info {
  display: flex;
  font-size: 13px;
  margin-top: 15px;
  border-bottom: 1px solid rgba(100, 100, 100, 0.1);
  justify-content: space-between;
  line-height: 30px;
}
.service-info {
  display: flex;
  justify-content: space-between;
  line-height: 60px;
}
.service-item img {
  width: 14px;
  height: 14px;
  top: 2px;
  position: relative;
}
.service-item span {
  font-size: 13px;
  color: #333;
}
</style>